#include<cstdio>
#define maxn 1010 
#define maxw 10010 
#define INF 2000000000
using namespace std;
const int mod = 1000000007;
//f [i ][j ]表示使用前i 种纸币，凑够j 的金额的纸币组合数 
int f[maxw], a[maxn], c1 = 0, c2 = 1;
int main() {
int n, w; scanf("%d", &n);
for (int i= 1; i<= n; i++) scanf ("%d", &a[i]); scanf ("%d", &w);
f[0] = 1;
for (int i = 1; i <= n; i++)
for (int j = a [i ]; j<=w ;j++ )
f[j] = (f[j] + f[j - a[i]]) %mod;
printf ("%d", f[w]); return 0;
}